package com.mc.moring.main.adapter

import android.content.Context
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.mc.moring.R
import com.mc.moring.bean.baseBean.MessageData
import java.util.*

/**
 * author: Created by nao on 2018-09-18
 * version: 1.0.0
 */
class MyTradeListAdapter(val context: Context, val data: ArrayList<MessageData>, layoutId: Int) : NArrayListAdapter<MessageData>(context, data, layoutId) {

	override fun getViewHolder(): BaseViewHolder = ViewHolder()

	override fun initView(viewHolder: BaseViewHolder, convertView: View, position: Int) {
		val mViewHolder = viewHolder as ViewHolder
		mViewHolder.title = convertView.findViewById(R.id.tv_title)
		mViewHolder.content = convertView.findViewById(R.id.tv_content)
//		mViewHolder.time = convertView.findViewById(R.id.tv_time)

//		mViewHolder.imageView = convertView.findViewById(R.id.imageView)
	}

	override fun setData(viewHolder: BaseViewHolder, convertView: View, position: Int) {
		if (mData == null || mData.isEmpty()) {
			return
		}
		val listBean = mData[position]
		val mViewHolder = viewHolder as ViewHolder

		mViewHolder.title.text = listBean.title
		mViewHolder.content.text = listBean.text
//		mViewHolder.time.text = listBean.createTime

//		val picPath = CommonUtil.loadUrl(listBean.picPath)
//		GlideUtils(mContext).loadRoundedView(picPath, 15, mViewHolder.imageView)
	}

	internal class ViewHolder : BaseViewHolder() {
		lateinit var title: TextView
		lateinit var content: TextView
		lateinit var time: TextView

		lateinit var imageView: ImageView
	}
}
